package ru.ipo.dces.plugins.expressolympu2;

import javax.swing.*;
import java.awt.*;

import ru.ipo.dces.exceptions.GeneralRequestFailureException;
import ru.ipo.dces.pluginapi.Plugin;
import ru.ipo.dces.pluginapi.PluginEnvironment;
import ru.ipo.dces.utils.ResultUtils;

/**
 *
 * @author push_king
 */
public class ExpressOlympUPlugin extends JPanel implements Plugin {

    //Заводим поле, в котором хранится окружение плагина. Через это окружение плагин общается с системой.
    private PluginEnvironment env;
    private int scores = 0;
    private String answertrue = new String();
    String useranswer = new String();
    private String usercheck = new String();

    //Плагин обязан иметь конструктор от PluginEnvironment
    public ExpressOlympUPlugin(PluginEnvironment env) {
        this.env = env;
        initComponents();
    }

    //следующие три метода реализуют интерфейс Plugin
    public JPanel getPanel() {
        //необходимо вернуть окно, на котором отображается плагин.
        //Возвращаем окно, которым является как раз текущий объект
        return this;
    }

    public void activate() {
        //вызывается при выборе задачи. Ничего не будем делать, только напишем отладочный вывод:
        System.out.println("Plugin activated");
    }

    public void deactivate() {
        //вызывается если участник выбрал другую задачу. Ничего не будем делать, только напишем отладочный вывод:
        System.out.println("Plugin deactivated");
    }

    private void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();
        buttonGroup5 = new javax.swing.ButtonGroup();
        jScrollPane2 = new javax.swing.JScrollPane();
        statement = env.getStatementPanel();
        answerPanel = new javax.swing.JPanel();
        rb4m = new javax.swing.JRadioButton();
        rb40 = new javax.swing.JRadioButton();
        rb3p = new javax.swing.JRadioButton();
        jLabel7 = new javax.swing.JLabel();
        rb5q = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        rb3q = new javax.swing.JRadioButton();
        rb5p = new javax.swing.JRadioButton();
        rb1p = new javax.swing.JRadioButton();
        jLabel9 = new javax.swing.JLabel();
        rb4p = new javax.swing.JRadioButton();
        rb2m = new javax.swing.JRadioButton();
        jLabel6 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        rb20 = new javax.swing.JRadioButton();
        rb1m = new javax.swing.JRadioButton();
        rb3m = new javax.swing.JRadioButton();
        rb50 = new javax.swing.JRadioButton();
        jLabel2 = new javax.swing.JLabel();
        rb10 = new javax.swing.JRadioButton();
        rb2p = new javax.swing.JRadioButton();
        rb4q = new javax.swing.JRadioButton();
        rb5m = new javax.swing.JRadioButton();
        rb1q = new javax.swing.JRadioButton();
        jLabel8 = new javax.swing.JLabel();
        rb30 = new javax.swing.JRadioButton();
        rb2q = new javax.swing.JRadioButton();
        jLabel5 = new javax.swing.JLabel();
        FAQPanel = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        sendAnswPanel = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        sendAnswerButton = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();

        setName("Form");

        jScrollPane2.setName("jScrollPane2");

        statement.setName("statement");
        jScrollPane2.setViewportView(statement);

        answerPanel.setName("answerPanel");

        buttonGroup4.add(rb4m);
        rb4m.setName("rb4m");

        buttonGroup4.add(rb40);
        rb40.setName("rb40");

        buttonGroup3.add(rb3p);
        rb3p.setName("rb3p");

        jLabel7.setFont(jLabel7.getFont().deriveFont(jLabel7.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel7.setText("3");
        jLabel7.setName("jLabel7");

        buttonGroup5.add(rb5q);
        rb5q.setName("rb5q");

        jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel4.setText("0");
        jLabel4.setName("jLabel4");

        buttonGroup3.add(rb3q);
        rb3q.setName("rb3q");

        buttonGroup5.add(rb5p);
        rb5p.setName("rb5p");

        buttonGroup1.add(rb1p);
        rb1p.setName("rb1p");

        jLabel9.setFont(jLabel9.getFont().deriveFont(jLabel9.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel9.setText("5");
        jLabel9.setName("jLabel9");

        buttonGroup4.add(rb4p);
        rb4p.setName("rb4p");

        buttonGroup2.add(rb2m);
        rb2m.setName("rb2m");

        jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel6.setText("2");
        jLabel6.setName("jLabel6");

        jLabel3.setFont(jLabel3.getFont().deriveFont(jLabel3.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel3.setText("?");
        jLabel3.setName("jLabel3");

        jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel1.setText("+");
        jLabel1.setName("jLabel1");

        buttonGroup2.add(rb20);
        rb20.setName("rb20");

        buttonGroup1.add(rb1m);
        rb1m.setName("rb1m");

        buttonGroup3.add(rb3m);
        rb3m.setName("rb3m");

        buttonGroup5.add(rb50);
        rb50.setName("rb50");

        jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel2.setText("-");
        jLabel2.setName("jLabel2");

        buttonGroup1.add(rb10);
        rb10.setName("rb10");

        buttonGroup2.add(rb2p);
        rb2p.setName("rb2p");

        buttonGroup4.add(rb4q);
        rb4q.setName("rb4q");

        buttonGroup5.add(rb5m);
        rb5m.setName("rb5m");

        buttonGroup1.add(rb1q);
        rb1q.setName("rb1q");

        jLabel8.setFont(jLabel8.getFont().deriveFont(jLabel8.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel8.setText("4");
        jLabel8.setName("jLabel8");

        buttonGroup3.add(rb30);
        rb30.setName("rb30");

        buttonGroup2.add(rb2q);
        rb2q.setName("rb2q");

        jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() | java.awt.Font.BOLD, 18));
        jLabel5.setText("1");
        jLabel5.setName("jLabel5");

        javax.swing.GroupLayout answerPanelLayout = new javax.swing.GroupLayout(answerPanel);
        answerPanel.setLayout(answerPanelLayout);
        answerPanelLayout.setHorizontalGroup(
                answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(answerPanelLayout.createSequentialGroup().addContainerGap().addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel9).addComponent(jLabel7).addComponent(jLabel8).addComponent(jLabel6).addComponent(jLabel5)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel1).addComponent(rb5p, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb3p, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb4p, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb2p, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb1p, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel2).addComponent(rb5m, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb3m, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb4m, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb2m, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb1m, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel3).addComponent(rb5q, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb4q, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb3q, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb2q, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb1q, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel4).addComponent(rb50, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb40, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb30, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb20, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(rb10, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));
        answerPanelLayout.setVerticalGroup(
                answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(answerPanelLayout.createSequentialGroup().addContainerGap().addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel1).addComponent(jLabel2).addComponent(jLabel3).addComponent(jLabel4)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel5).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(rb1m).addComponent(rb1q).addComponent(rb10)).addComponent(rb1p)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel6).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(rb20).addComponent(rb2m).addComponent(rb2q).addComponent(rb2p))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(rb3p).addComponent(rb3m).addComponent(rb3q).addComponent(rb30)).addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(rb4m).addComponent(rb4p).addComponent(rb4q).addComponent(rb40))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel9).addGroup(answerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(rb5q).addComponent(rb5m).addComponent(rb5p).addComponent(rb50))).addContainerGap()));

        FAQPanel.setName("FAQPanel");

        jLabel13.setFont(jLabel13.getFont().deriveFont((float) 14));
        jLabel13.setText("-  нет (утверждение не верно)");
        jLabel13.setName("jLabel13");

        jLabel15.setFont(jLabel15.getFont().deriveFont((float) 14));
        jLabel15.setText("0  пропускаю вопрос");
        jLabel15.setName("jLabel15");

        jLabel12.setFont(jLabel12.getFont().deriveFont((float) 14));
        jLabel12.setText("+ да (утверждение верно)");
        jLabel12.setName("jLabel12");

        jLabel14.setFont(jLabel14.getFont().deriveFont((float) 14));
        jLabel14.setText("?  возможно несколько ответов");
        jLabel14.setName("jLabel14");

        javax.swing.GroupLayout FAQPanelLayout = new javax.swing.GroupLayout(FAQPanel);
        FAQPanel.setLayout(FAQPanelLayout);
        FAQPanelLayout.setHorizontalGroup(
                FAQPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(FAQPanelLayout.createSequentialGroup().addContainerGap().addGroup(FAQPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel12).addComponent(jLabel13).addComponent(jLabel14).addComponent(jLabel15)).addContainerGap()));
        FAQPanelLayout.setVerticalGroup(
                FAQPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(FAQPanelLayout.createSequentialGroup().addContainerGap().addComponent(jLabel12).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel13).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel14).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel15).addContainerGap()));

        sendAnswPanel.setName("sendAnswPanel");

        jLabel10.setFont(jLabel10.getFont().deriveFont((float) 14));
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel10.setText("Ответьте на все вопросы");
        jLabel10.setName("jLabel10");

        sendAnswerButton.setFont(sendAnswerButton.getFont().deriveFont(sendAnswerButton.getFont().getStyle() | java.awt.Font.BOLD, 14));
        sendAnswerButton.setText("Отправить");
        sendAnswerButton.setName("sendAnswerButton");
        sendAnswerButton.addMouseListener(new java.awt.event.MouseAdapter() {

            @Override
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                sendAnswerButtonMouseClicked(evt);
            }
        });

        jLabel11.setFont(jLabel11.getFont().deriveFont((float) 14));
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("и нажмите \"Отправить\"");
        jLabel11.setName("jLabel11");

        javax.swing.GroupLayout sendAnswPanelLayout = new javax.swing.GroupLayout(sendAnswPanel);
        sendAnswPanel.setLayout(sendAnswPanelLayout);
        sendAnswPanelLayout.setHorizontalGroup(
                sendAnswPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(sendAnswPanelLayout.createSequentialGroup().addContainerGap().addGroup(sendAnswPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER).addComponent(jLabel10).addComponent(sendAnswerButton).addComponent(jLabel11)).addContainerGap()));
        sendAnswPanelLayout.setVerticalGroup(
                sendAnswPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(sendAnswPanelLayout.createSequentialGroup().addContainerGap().addComponent(jLabel10).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel11).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sendAnswerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap()));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 513, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(FAQPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(answerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(sendAnswPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap(622, Short.MAX_VALUE)));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(answerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sendAnswPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(FAQPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap()));
    }

    private void sendAnswerButtonMouseClicked(java.awt.event.MouseEvent evt) {
        //убедиться, что участник действительно собирается отправить решение.
        if (okcancel("Вы уверены ?") == 0) {
            useranswer = getUserAnswer();
            if (useranswer.length() != 5) {
                JOptionPane.showMessageDialog(this, "Не удалось отправить решение. Вы ответили не на все вопросы.");
                return;
            }
/*
            answertrue = env.getExtendedProblem().getString("right answer"); //добываем строку из задачи
            checkAnswer();
*/
            try {
                env.submitSolution(
                        ResultUtils.newMap(
                        "useranswer",
                        useranswer));
                JOptionPane.showMessageDialog(this, "Решение отослано");
            } catch (GeneralRequestFailureException e1) {
                JOptionPane.showMessageDialog(this, "Не удалось отправить решение");
            }
        }
    }

    private String getUserAnswer() {
        String usansw = "";

        if (rb10.isSelected()) {
            usansw += "0";
        }
        if (rb1p.isSelected()) {
            usansw += "+";
        }
        if (rb1m.isSelected()) {
            usansw += "-";
        }
        if (rb1q.isSelected()) {
            usansw += "?";
        }

        if (rb20.isSelected()) {
            usansw += "0";
        }
        if (rb2p.isSelected()) {
            usansw += "+";
        }
        if (rb2m.isSelected()) {
            usansw += "-";
        }
        if (rb2q.isSelected()) {
            usansw += "?";
        }

        if (rb30.isSelected()) {
            usansw += "0";
        }
        if (rb3p.isSelected()) {
            usansw += "+";
        }
        if (rb3m.isSelected()) {
            usansw += "-";
        }
        if (rb3q.isSelected()) {
            usansw += "?";
        }

        if (rb40.isSelected()) {
            usansw += "0";
        }
        if (rb4p.isSelected()) {
            usansw += "+";
        }
        if (rb4m.isSelected()) {
            usansw += "-";
        }
        if (rb4q.isSelected()) {
            usansw += "?";
        }

        if (rb50.isSelected()) {
            usansw += "0";
        }
        if (rb5p.isSelected()) {
            usansw += "+";
        }
        if (rb5m.isSelected()) {
            usansw += "-";
        }
        if (rb5q.isSelected()) {
            usansw += "?";
        }

        return usansw;
    }

    private void checkAnswer() {
        scores = 0;
        usercheck = "";
        for (int i = 0; i < 5; i++) {
            if (useranswer.charAt(i) == answertrue.charAt(i)) {
                trueAnswer();
            } else if (useranswer.charAt(i) == '0') {
                skipAnswer();
            } else {
                falseAnswer();
            }
        }
    }

    private void trueAnswer() {
        scores += 2;
        usercheck += "+";
    }

    private void falseAnswer() {
        usercheck += "-";
    }

    private void skipAnswer() {
        scores++;
        usercheck += "0";
    }

    public static int okcancel(String theMessage) {
        int result = JOptionPane.showConfirmDialog((Component) null, theMessage,
                "Подтвердите отправку решения", JOptionPane.OK_CANCEL_OPTION);
        return result;
    }
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.ButtonGroup buttonGroup5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel FAQPanel;
    private javax.swing.JPanel answerPanel;
    private javax.swing.JPanel sendAnswPanel;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JComponent statement;
    private javax.swing.JRadioButton rb10;
    private javax.swing.JRadioButton rb1m;
    private javax.swing.JRadioButton rb1p;
    private javax.swing.JRadioButton rb1q;
    private javax.swing.JRadioButton rb20;
    private javax.swing.JRadioButton rb2m;
    private javax.swing.JRadioButton rb2p;
    private javax.swing.JRadioButton rb2q;
    private javax.swing.JRadioButton rb30;
    private javax.swing.JRadioButton rb3m;
    private javax.swing.JRadioButton rb3p;
    private javax.swing.JRadioButton rb3q;
    private javax.swing.JRadioButton rb40;
    private javax.swing.JRadioButton rb4m;
    private javax.swing.JRadioButton rb4p;
    private javax.swing.JRadioButton rb4q;
    private javax.swing.JRadioButton rb50;
    private javax.swing.JRadioButton rb5m;
    private javax.swing.JRadioButton rb5p;
    private javax.swing.JRadioButton rb5q;
    private javax.swing.JButton sendAnswerButton;
}